import java.util.ArrayList;
import java.util.List;

public class LC1431 {
    public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
        int maxCandies = -1;
        ArrayList<Boolean> results = new ArrayList<>(candies.length);
        for (int i = 0; i < candies.length; i++) {
            if (candies[i] > maxCandies) maxCandies = candies[i];
        }
        for (int i = 0; i < candies.length; i++) {
            if ((maxCandies - candies[i]) <= extraCandies) {
                results.add(true);
            }
            else {
                results.add(false);
            }
        }

        return results;
    }
}
